﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.esriSystem;
using NcgmpDataAccess.Utilities.Licensing;

namespace NcgmpDataAccess.Testing.Licensing
{
    static class LicenseAccess
    {
        private static LicenseInitializer m_AOLicenseInitializer = new LicenseInitializer();
        public static LicenseInitializer g_AOLicenseInitializer
        {
            get
            {
                return m_AOLicenseInitializer;
            }
        }

        public static void ActivateLicense()
        {
            if (m_AOLicenseInitializer.InitializedProduct != esriLicenseProductCode.esriLicenseProductCodeArcInfo)
            {
                m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeArcInfo },
            new esriLicenseExtensionCode[] { });
            }
        }

        public static void DeactivateLicense()
        {
            if (m_AOLicenseInitializer.InitializedProduct == ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcInfo)
            {
                m_AOLicenseInitializer.ShutdownApplication();
            }
        }
    }
}
